#include<iostream>
#include<cstdio>
#define int long long
using namespace std;
class Data{
    public:
        int n;
        int pos;
        Data(int x,int p){
            this->n = x;
            this->pos = p;
        }
        Data(){
            this->n=0;this->pos=-1;
        }
        operator <(Data other){
            return this->n < other.n;
        }
        operator >(Data other){
            return this->n > other.n;
        }
        operator ==(Data other){
            return this->n == other.n;
        }
};
Data arr[8200],arr2[8200];
void mergesort(int ln,Data array[]){
    if(ln<=1){
        return;
    }
    int mid=ln/2;
    int rmid = ln-mid;
    Data arrayx[mid];
    Data arrayy[rmid];
    for(int i=0;i<mid;i++){
        arrayx[i] = array[i];
    }
    for(int i=0;i<rmid;i++){
        arrayy[i] = array[i+mid];
    }
    mergesort(mid,arrayx);
    mergesort(rmid,arrayy);
    int pa=0,pb=0;
    for(int i=0;i<ln;i++){
        if((pa<mid)&&((pb>=rmid)||(arrayx[pa]<arrayy[pb]))){
            array[i] = arrayx[pa];pa++;
        }else{
            array[i] = arrayy[pb];pb++;
        }
    }
}
signed main(){
    freopen("sort.in","r",stdin);
    freopen("sort.out","w",stdout);
    int n,q,tmp,cmd,x,v;
    cin >> n >> q;
    for(int i=0;i<n;i++){
        cin >> tmp;
        arr[i] = Data(tmp,i);
    }
    bool is_sorted = false;
    Data t;
    for(int i=0;i<q;i++){
        cin >> cmd;
        if(cmd==1){
            cin >> x >> v;
            arr[x-1].n = v;
            is_sorted = false;
        }else{//cmd==2
            cin >> x;
            if(!is_sorted){
                for(int i=0;i<n;i++){
                    arr2[i] = arr[i];
                }
//                mergesort(n,arr2);
                for (int i = 0; i < n; i++)
for (int j = i; j>=1; j--)
if ( arr2[j] < arr2[j-1] ){
t = arr2[j-1];
arr2[j-1] = arr2[j];
arr2[j] = t;
}
                is_sorted = true;
            }
            for(int i=0;i<n;i++){
                if((arr2[i].pos+1)==x){
                    cout << i+1 << endl;
                    break;
                }
            }
        }
    }
    return 0;
}
/*
3 4
3 2 1
2 3
1 3 2
2 2
2 3
*/
